home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The PC-SIG Library 9
/
The PC-SIG Library on CD ROM - Ninth Edition.iso
/
101_200
/
DISK0163
/
DISK0163.ZIP
/
CRYPT.C
< prev
next >
Wrap
Text File
|
1983-08-22
|
640b
|
28 lines
/* crypt.c by Michael Hanson */
/* you may use this, but not for profit, and give me credit */
/* encryption program, decryption program */
#include "stdio.h"
#include "errs.c"
#include "version.c"
#include "filp.c"
main(argc,argv)
int argc;
char *argv[];
{
int c,i,keylen;
if(ver() < 0x200){
error("wrong DOS version",1);
#asm
db 'by Michael Hanson v1.0',1ah
#
}
if ((argc > 1) && ((keylen = strlen(argv[1])) > 0))
for (i=0; (c=getc(STDIN)) != EOF; i =(++i % keylen))
putc((char)((char)c ^ (argv[1])[i]),STDOUT);
/* xor c key[i] */
else
error("usage: crypt key.",1);
}